// react
import React from "react";
// lib
import { Space, Button } from "antd";
// components & widget
// style
// config
// script & methods & public
// store
import { state } from "./state";
import { dictState } from "state/global";
// controller
// interface
// 其它

const TableColumns = [
  {
    title: "副本ID",
    dataIndex: "copyId",
  },
  {
    title: "图书名称",
    dataIndex: "title",
  },
  {
    title: "作者",
    dataIndex: "author",
  },
  {
    title: "出版社",
    dataIndex: "publisher",
  },
  {
    title: "ISBN",
    dataIndex: "isbn",
  },
  {
    title: "所在书架",
    dataIndex: "shelfId",
    render:(el:number) => {
      return state.getShelfList().find((item) => item.shelfId === el)?.shelfName;
    }
  },
  {
    title: "层数",
    dataIndex: "shelfLevel",
  },
  {
    title: "购买日期",
    dataIndex: "buyDate",
  },
  {
    title: "购买价格",
    dataIndex: "buyPrice",
  },
  {
    title: "购买来源",
    dataIndex: "sourceId",
    render:(el:number) => state.getSourceList().find(item => item.sourceId === el)?.sourceName
  },
  {
    title: "状态",
    dataIndex: "status",
    render: (el:string) => dictState.CopyStatusList.find(item => item.code === el)?.name
  },
  {
    title: "操作",
    key: "action",
    fixed: "right" as any,
    render: (el: CopyDto) => {
      const edit = () => {
        state.editModal = el;
      };
     
      return (
        <Space>
          <Button size="small" type="primary" ghost onClick={edit}>
            编辑
          </Button>
        </Space>
      );
    },
  },
];

export default TableColumns;
